<?php
include_once (dirname(__FILE__) . "/includes/init.php");

global $smarty;

$article_id = intval($_REQUEST['article_id']);
if ($article_id > 0) {
	$sql = "select * from article where article_id = '{$article_id}'";
	$article = $db->getRow($sql);
	
	
	$sql = "select * from article where article_id > '{$article_id}' order by article_id";
	$next_article = $db->getRow($sql);
	$sql = "select * from article where article_id < '{$article_id}' order by article_id desc";
	$last_article = $db->getRow($sql);
	
	$smarty->assign("article", $article);
	$smarty->assign("next_article", $next_article);
	$smarty->assign("last_article", $last_article);
}

$smarty->display("article.html");